

import 'package:cbec_app/entity/home/content/content_data.dart';

class GrouponActivity extends ContentData {
  String activityName;
  int moreBtnStyle;
  String displayScale;
  String imageFillStyle;
  String title;
  String textAlignType;
  String uuid;
  String topBgColor;
  String activityNameColor;
  String textStyleType;
  String price;
  String showStockNum;
  String moreBtnColor;
  List<dynamic> subEntry; // Adjust type as needed
  int pageMargin;
  String sizeType;
  String showCountDown;
  String moreBtnText;
  String automatic;
  String borderRadiusType;
  int goodsMargin;
  String showSoldNum;
  String moreShow;
  String size;
  String originPrice;

  GrouponActivity({
    required this.activityName,
    required this.moreBtnStyle,
    required this.displayScale,
    required this.imageFillStyle,
    required this.title,
    required this.textAlignType,
    required this.uuid,
    required this.topBgColor,
    required this.activityNameColor,
    required this.textStyleType,
    required this.price,
    required this.showStockNum,
    required this.moreBtnColor,
    required this.subEntry,
    required this.pageMargin,
    required this.sizeType,
    required this.showCountDown,
    required this.moreBtnText,
    required this.automatic,
    required this.borderRadiusType,
    required this.goodsMargin,
    required this.showSoldNum,
    required this.moreShow,
    required this.size,
    required this.originPrice,
  }) {
    type = "groupon"; // Set the type based on the JSON
  }
  
  factory GrouponActivity.fromJson(Map<String, dynamic> json) {
    return GrouponActivity(
      activityName: json['activity_name'],
      moreBtnStyle: json['more_btn_style'],
      displayScale: json['display_scale'],
      imageFillStyle: json['image_fill_style'],
      title: json['title'],
      textAlignType: json['text_align_type'],
      uuid: json['uuid'],
      topBgColor: json['top_bg_color'],
      activityNameColor: json['activity_name_color'],
      textStyleType: json['text_style_type'],
      price: json['price'],
      showStockNum: json['show_stock_num'],
      moreBtnColor: json['more_btn_color'],
      subEntry: json['sub_entry'],
      pageMargin: json['page_margin'],
      sizeType: json['size_type'],
      showCountDown: json['show_count_down'],
      moreBtnText: json['more_btn_text'],
      automatic: json['automatic'],
      borderRadiusType: json['border_radius_type'],
      goodsMargin: json['goods_margin'],
      showSoldNum: json['show_sold_num'],
      moreShow: json['more_show'],
      size: json['size'],
      originPrice: json['origin_price'],
    );
  }

   @override
  ContentData fromJson(Map<String, dynamic> json) {
    return GrouponActivity.fromJson(json);
  }

  @override
  Map<String, dynamic> toJson() {
    return {
      'activity_name': activityName,
      'more_btn_style': moreBtnStyle,
      'display_scale': displayScale,
      'image_fill_style': imageFillStyle,
      'type': type,
      'title': title,
      'text_align_type': textAlignType,
      'uuid': uuid,
      'top_bg_color': topBgColor,
      'activity_name_color': activityNameColor,
      'text_style_type': textStyleType,
      'price': price,
      'show_stock_num': showStockNum,
      'more_btn_color': moreBtnColor,
      'sub_entry': subEntry,
      'page_margin': pageMargin,
      'size_type': sizeType,
      'show_count_down': showCountDown,
      'more_btn_text': moreBtnText,
      'automatic': automatic,
      'border_radius_type': borderRadiusType,
      'goods_margin': goodsMargin,
      'show_sold_num': showSoldNum,
      'more_show': moreShow,
      'size': size,
      'origin_price': originPrice,
    };
  }
}
